Skip to content

build: wire the AdaWorldAPI RustCrypto forks and keep foreign SIMD out - #369

Merged
AdaWorldAPI merged 1 commit into
mainfrom
feat/rustcrypto-fork-patches
Nov 4, 2026
Merged

AdaWorldAPI merged 1 commit into
mainfrom
feat/rustcrypto-fork-patches

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

What

OGAR's crypto crates (ogar-encryption, ogar-auth, ogar-oidc) resolved almost every RustCrypto crate from crates.io, even though AdaWorldAPI forks of most of them exist. This PR points them at the forks and stops these crates from compiling their own AVX intrinsics.

  • The fork commit, not the fork branch. Each fork's default branch is already a major version ahead of what OGAR uses: chacha20poly1305 0.11 against 0.10.1, curve25519-dalek 5 against 4.1.3, and so on. Cargo silently ignores a patch whose version doesn't match, so each entry is pinned to the fork commit whose Cargo.toml has exactly the version the registry would resolve.
  • chacha20 comes from ndarray's own fork (vendor/chacha20), which adds an ndarray::simd::U32x16 backend. ndarray already uses it inside its own workspace, but OGAR builds never got it until now.
  • .cargo/config.toml sets two flags, as ndarray does:
    • curve25519_dalek_backend="serial" stops curve25519-dalek's build script from auto-selecting its AVX2 backend;
    • poly1305_force_soft stops poly1305 from selecting its AVX2 backend.
crate resolves from now
ecdsa 0.17.0 signatures 5595c3b (unchanged, from #367)
chacha20poly1305 0.10.1 AEADs c5c1999
chacha20 0.9.1 ndarray vendor/chacha20, branch master
poly1305 0.8.0 universal-hashes 35de31a
curve25519-dalek 4.1.3 curve25519-dalek 5312a03
ed448-goldilocks 0.14.0-pre.15 elliptic-curves f5cb30e
md-5 0.10.6 hashes 026b0e8
des 0.8.1 block-ciphers 7de364e

Still crates.io, because no fork commit carries the resolved version:

  • sha2 0.10.9 and 0.11.1, sha1 0.10.7, blake2 0.11.0 and ed25519-dalek 2.2.0. These were most likely released from upstream maintenance branches that the forks did not copy.
  • aead, cipher, digest, universal-hash and signature (the trait crates) and hmac. These have no fork that I checked.

Both lists are recorded in docs/UPSTREAM-DEPS.md.

Measured

  • Patches resolve. A fresh cargo generate-lockfile gives no "patch was not used" warning, and cargo tree shows every patched crate at its fork source.
  • The flags reach the compiler. cargo build -v -p ogar-encryption passes --cfg curve25519_dalek_backend="serial" to curve25519-dalek and --cfg poly1305_force_soft to poly1305.
  • Checks:
    • cargo check --workspace --all-targets: clean.
    • cargo test -p ogar-encryption -p ogar-auth -p ogar-oidc -p ogar-rbac: green. This includes the envelope seal/open round trips over the patched XChaCha20-Poly1305.
    • cargo clippy on the same four crates with -D warnings: clean.
    • cargo fmt --all -- --check: clean.

Scope limit

Cargo never applies a dependency's [patch] or .cargo/config.toml downstream. a2ui-rs, report-rs and every other consumer of OGAR crates still get the registry versions, and dalek's AVX2 backend, unless they repeat this block and these flags. That is a follow-up in each consumer repo.

One more caution: a RUSTFLAGS environment variable replaces the config's flags instead of adding to them. OGAR's CI sets none.


Generated by Claude Code

[patch.crates-io] now resolves chacha20poly1305, chacha20 (ndarray's
ndarray::simd fork), poly1305, curve25519-dalek, ed448-goldilocks, md-5 and
des to their AdaWorldAPI forks, each at the fork commit carrying the exact
version the registry would resolve (fork default branches are a major ahead;
a mismatched patch is silently unused). sha2, sha1 0.10.7, blake2 0.11.0 and
ed25519-dalek 2.2.0 have no matching fork commit and stay on crates.io;
docs/UPSTREAM-DEPS.md records both lists.

.cargo/config.toml sets curve25519_dalek_backend="serial" and
poly1305_force_soft, as ndarray does, so the crypto crates compile no AVX2
intrinsics of their own.

Fresh generate-lockfile: no unused-patch warning. cargo check --workspace
--all-targets clean; ogar-encryption/-auth/-oidc/-rbac tests green.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XAqKMQJzQD5KvNm8BtbsWG
@coderabbitai

coderabbitai Bot commented Nov 4, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e56cce3e-e211-4d82-a301-bfe635ba95c8
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T23:03:37.776058Z 6b53a03 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@AdaWorldAPI
AdaWorldAPI merged commit 531b0b9 into main Nov 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants